home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17658 < prev    next >
Encoding:
Text File  |  1996-08-05  |  3.8 KB  |  87 lines

  1. Path: news.ran.es!usenet
  2. From: chano@ran.es (Chano G≤mez Martφnez)
  3. Newsgroups: comp.os.linux.setup,comp.os.linux.misc,comp.os.linux,comp.lang.c,comp.lang.c++
  4. Subject: problems with GCC
  5. Date: Tue, 16 Apr 1996 21:52:07 GMT
  6. Organization: RAN INTERNET
  7. Message-ID: <4l1and$iql@news.ran.es>
  8. NNTP-Posting-Host: pppv02.ran.es
  9. X-Newsreader: Forte Free Agent 1.0.82
  10.  
  11. First of all, I want to apologize for my awful English.
  12.  
  13. Now, the C stuff :
  14.  
  15. I'm trying to port a C program from Borland C++ 3.1 to GCC under
  16. Linux.
  17. My problem is that I can't use any function from math.h !!!
  18. The file is correctly #include'd ( in fact, I get no compilation
  19. errors ) but the linker always tells me something like :
  20.  
  21. /tmp/cca000971.o(.text+0x39): undefined reference to `exp'
  22.  
  23. The funny thing is that GPC ( the GNU Pascal compiler ) allows me to
  24. use math.h functions lihe exp(), sin(), fabs(), etc, but when I
  25. convert my Pascal programs to C with p2c and try to compile them with
  26. GCC , I get the same error again.
  27.  
  28. Here is the result from compiling the Pascal source with GPC -v ...
  29. ================================================
  30.  
  31. Reading specs from /usr/lib/gcc-lib/i486-linux/2.6.3/specsgcc version
  32. 2.6.3 /usr/lib/gcc-lib/i486-linux/2.6.3/gpc-cpp -lang-pascal -v
  33. -nocharescape -undef -D__GNUC__=2 -D__GPC__=2 -D__GNUC_MINOR__=6
  34. -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__i386
  35. -D__linux -Asystem(unix) -Asystem(posix) -Acpu(i386) -Amachine(i386)
  36. -D__i486__ mat.p /tmp/cca00103.iGNU CPP version 2.6.3 (i386
  37. Linux/ELF)#include "..." search starts here:#include <...> search
  38. starts here: /usr/local/include /usr/i486-linux/include
  39. /usr/lib/gcc-lib/i486-linux/2.6.3/include /usr/includeEnd of search
  40. list. /usr/lib/gcc-lib/i486-linux/2.6.3/gpc1 /tmp/cca00103.i -quiet
  41. -dumpbase mat.pas -version -o /tmp/cca00103.sGNU PASCAL version 2.6.3
  42. (i386 Linux/ELF) compiled by GNU C version 2.6.3.
  43. /usr/i486-linux/bin/as -V -Qy -o /tmp/cca001031.o /tmp/cca00103.sGNU
  44. assembler version cygnus/linux-2.5.2l.15 (i486-linux), using BFD
  45. version cygnus/linux-2.5.2l.11 /usr/i486-linux/bin/ld -m elf_i386
  46. -dynamic-linker /lib/ld-linux.so.1 /usr/lib/crt1.o /usr/lib/crti.o
  47. /usr/lib/crtbegin.o -L/usr/lib/gcc-lib/i486-linux/2.6.3
  48. -L/usr/i486-linux/lib /tmp/cca001031.o -lgpc -lgcc -lm -lc -lgcc
  49. /usr/lib/crtend.o /usr/lib/crtn.o
  50.  
  51. =====================
  52.  
  53. and now the result from GCC :
  54.  
  55. =============================
  56. Reading specs from /usr/lib/gcc-lib/i486-linux/2.7.0/specsgcc version
  57. 2.7.0 /usr/lib/gcc-lib/i486-linux/2.7.0/cpp -lang-c -v -undef
  58. -D__GNUC__=2 -D__GNUC_MINOR__=7 -D__ELF__ -Dunix -Di386 -Dlinux
  59. -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__i386
  60. -D__linux -Asystem(unix) -Asystem(posix) -Acpu(i386) -Amachine(i386)
  61. -D__i486__ mat.c /tmp/cca00097.iGNU CPP version 2.7.0 (i386
  62. Linux/ELF)#include "..." search starts here:#include <...> search
  63. starts here: /usr/local/include /usr/i486-linux/include
  64. /usr/lib/gcc-lib/i486-linux/2.7.0/include /usr/includeEnd of search
  65. list. /usr/lib/gcc-lib/i486-linux/2.7.0/cc1 /tmp/cca00097.i
  66. -fno-strength-reduce -quiet -dumpbase mat.c -version -o
  67. /tmp/cca00097.sGNU C version 2.7.0 (i386 Linux/ELF) compiled by GNU C
  68. version 2.7.0. /usr/i486-linux/bin/as -V -Qy -o /tmp/cca000971.o
  69. /tmp/cca00097.sGNU assembler version cygnus/linux-2.5.2l.15
  70. (i486-linux), using BFD version cygnus/linux-2.5.2l.11
  71. /usr/i486-linux/bin/ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.1
  72. /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o
  73. -L/usr/lib/gcc-lib/i486-linux/2.7.0 -L/usr/i486-linux/lib
  74. /tmp/cca000971.o -lgcc -lc -lgcc /usr/lib/crtend.o
  75. /usr/lib/crtn.o/tmp/cca000971.o(.text+0xf): undefined reference to
  76. `PASCAL_MAIN'/tmp/cca000971.o(.text+0x39): undefined reference to
  77. `exp'
  78. ===========================
  79.  
  80. The only apparent difference between both results is in the libraries
  81. ( I think)
  82. Can anyone help me, please ???
  83.  
  84.    Thanks in advance.
  85.  
  86.  
  87.